package com.itcast.dao;

import com.github.pagehelper.Page;
import com.itcast.pojo.Setmeal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface SetmealDao {

    void add(Setmeal setmeal);
    @Insert("insert into health.t_setmeal_checkgroup values(#{setmealId},#{checkgroupId})")
    void addCheckgroupAndSetmeal(@Param("checkgroupId") int checkgroupId,@Param("setmealId") int setmealId);

    Page<Setmeal> findPage(String queryString);
    @Select("select * from t_setmeal")
    List<Setmeal> findAll();
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(@Param("id") int id);
    @Select("select s.name name ,count(to2.id) value from t_setmeal s join t_order to2 on s.id = to2.setmeal_id  group by s.id")
    List<Map<String,Object>> findSetmealCount();
}
